package com.lhd.mpaas.demo.utils;

import android.os.Bundle;

import com.alipay.mobile.framework.LauncherApplicationAgent;
import com.alipay.mobile.h5container.api.H5Bundle;
import com.alipay.mobile.h5container.api.H5Param;
import com.alipay.mobile.h5container.service.H5Service;

public class H5Util {

    public static void openH5(String h5Url) {
        String url = "https://mcube-prod.oss-cn-hangzhou.aliyuncs.com/226BA46061731-default/66666666/1.0.0.0_all/nebula/fallback/index.html";

        if (h5Url == null && "".equals(h5Url)) {
            url = h5Url;
        }

        H5Service h5Service = LauncherApplicationAgent.getInstance().getMicroApplicationContext()
                .findServiceByInterface(H5Service.class.getName());
        Bundle h5Bundle = new Bundle();
        h5Bundle.putString(H5Param.LONG_URL, url);
        h5Service.startPage(LauncherApplicationAgent.getInstance().getMicroApplicationContext().getTopApplication(),
                new H5Bundle(h5Bundle));
        return;
    }
}
